import pygame,sys
from pygame.locals import *

size = 600
pygame.init()
red,white = (255,0,0),(255,255,255)
turn = 10
board = []

while True:
     screen = pygame.display.set_mode([size,size])
     pygame.draw.rect(screen, white, (0, 0, size, size))

     pygame.draw.line(screen, red, (0,200), (size,200), 10)
     pygame.draw.line(screen, red, (0,400), (size,400), 10)
     pygame.draw.line(screen, red, (200,0), (200,size), 10)
     pygame.draw.line(screen, red, (400,0), (400,size), 10)
     for trun,x,y in board:
         if trun == 10:
             pygame.draw.line(screen, red, (200*x,200*y), (200+200*x,200+200*y), 5)
             pygame.draw.line(screen, red, (200+200*x,200*y), (200*x,200+200*y), 5)
         if trun == -10:
             pygame.draw.ellipse(screen, red, (x*200+20,y*200+20,150,150),5)

     pygame.display.flip()
     event = pygame.event.wait()
     if event.type == QUIT:
        pygame.quit()
        sys.exit()
     if event.type == MOUSEBUTTONDOWN and event.button == 1:
         turn *= -1
         pos = (turn,event.pos[0]/(size/3),event.pos[1]/(size/3))
         if pos not in board:
             board.append(pos)
 
